/**
 * 
 */
package com.study.adapter;

import java.util.List;

/**
 * @author Administrator
 * @date 2019年6月23日
 */
public class LogAdapter implements LogWriteDbService {

	private LogWriteFileService logWriteFileService;
	
	public LogAdapter(LogWriteFileService logWriteFileService){
		this.logWriteFileService = logWriteFileService;
	}
	
	/* 这个函数实现转换器的作用，对源logWriteFileService 的数据进行转换，用于目标输出
	 * @see com.study.adapter.LogWriteFileService#writeFile()
	 */
	public void writeLog() {
		//在适配器中，重写旧接口的方法来调用新接口方法.
		List<LogBean> logBeans = logWriteFileService.readLogFile();

		this.writeDb(logBeans);
		
	}
	
	public void writeDb(List<LogBean> logBeans) {
		System.out.println("数据写到数据库中。。" + logBeans.toString());

	}
}
